import { Component } from '@angular/core';
import { ConmonService } from "../service/common.service";
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
// import MUST from "../assets/js/must.js";
declare var Snap: any, mina: any;
// declare var must: any;
// interface must {
//   func:Function; 
// }
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})

export class AppComponent {
  title = 'app';
  openId: any;
  constructor(private service: ConmonService) {
    let dateObj = {};
    //获取openId的方法
    console.log(must);
    let _this = this;
    must.ready(function () {
      console.log(window);
      must.getOpenId({
        success: function (response) {
          // id = response.openId;
          console.log(response.openId);
          _this.getToken(response.openId);
          _this.service.openId = response.openId;
        }
      });
      // must.hideOptionMenu();
    });
    
  }
  getToken(openId) {
    this.service.getToken(1, openId, 'DailyWorkBasicInfo', true);
  }
  ngOnInit() {
    // this.service.getToken(1, 'openId', 'DailyWorkBasicInfo', true);
  };
}
